﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Heima.OA.Common
{
    public class ConstData
    {
        public static readonly string AttachmentDocPath = string.Format("/App_Data/Doc/{0}/{1}/", DateTime.Now.Year, DateTime.Now.Month);
        public static readonly string AttachmentImagePath = string.Format("/App_Data/Image/{0}/{1}/", DateTime.Now.Year, DateTime.Now.Month);
        public static readonly string AttachmentHtmlPath = string.Format("/App_Data/Html/{0}/{1}/", DateTime.Now.Year, DateTime.Now.Month);
        public static readonly string AttachmentOtherPath = string.Format("/App_Data/Other/{0}/{1}/", DateTime.Now.Year, DateTime.Now.Month);
        public static readonly string AttachmentBackPath = string.Format("/App_Data/Back/{0}/{1}/", DateTime.Now.Year, DateTime.Now.Month);

        public static string GetAttaPathByExtension(string extension)
        {
            string path = string.Empty;
            if (extension.Contains("doc") || extension.Contains("xls"))
            {
                path = AttachmentDocPath;
            }
            else if (extension.Contains("jpg") || extension.Contains("png"))
            {
                path = AttachmentImagePath;
            }
            else if (extension.Contains("pdf") || extension.Contains("html"))
            {
                path = AttachmentHtmlPath;
            }
            else
            {
                path = AttachmentOtherPath;
            }
            return path;
        }

    }
}
